package cn.zlp.hrm.client;

import cn.zlp.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @program: hrm-parent
 * @author: Mr.Zhang
 * @create: 2022-01-13 10:37
 **/
@Component
public class ThirdPartyServerClientFallBackFactory implements FallbackFactory<ThirdPartyServerClient> {
    @Override
    public ThirdPartyServerClient create(Throwable throwable) {
        return new ThirdPartyServerClient() {
            @Override
            public AjaxResult smsVerifyCode(Map<String, String> params) {
                return AjaxResult.me().setSuccess(false).setMessage("系统异常！"+throwable.getMessage());
            }

            @Override
            public AjaxResult verifySmsCode(Map<String, String> params) {
                return AjaxResult.me().setSuccess(false).setMessage("系统异常！"+throwable.getMessage());
            }

            @Override
            public AjaxResult sendSmsVerifyCode(Map<String, String> params) {
                return AjaxResult.me().setSuccess(false).setMessage("系统异常！"+throwable.getMessage());
            }
        };
    }
}
